package com.chief;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chief.entity.Account;
import com.chief.mapper.AccountMapper;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements AccountService {

    @Autowired
    private AccountMapper accountMapper;

    @Override
    public void reduce(Double amount) {
        Account account = new Account();
        account.setAmount(BigDecimal.valueOf(amount.doubleValue()));
        super.saveOrUpdate(account);
    }
}
